def txt = textArea.selectedText.trim()
def size = 50
def border = "-" * (size + 2)
textArea.selectedText = border + "\n" + txt.readLines().collect{ "-  " + it }.join("\n") + "\n" + border